import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Upload, Button, Input, message } from 'antd';
import CardCommon from '@/compontents/cardCommon';
import lhTool from 'lh-tool';
import api from '@/http/api';
import { PlusOutlined } from '@ant-design/icons';

export default (props: any) => {
  const [value3, setValue3] = useState('');
  const [value4, setValue4] = useState('');
  const [value5, setValue5] = useState('');
  const [value6, setValue6] = useState('');
  const { schoolId } = JSON.parse(sessionStorage.info).userInfo;
  useEffect(() => {
    api.concatInfo({ uSchoolId: schoolId }).then(res => {
      if (res.data) {
        setValue3(res.data.txt3);
        setValue4(res.data.txt4);
        setValue5(res.data.txt5);
        setValue6(res.data.txt6);
      }
    });
  }, []);

  const uploadButton = (
    <div>
      <PlusOutlined />
      <div style={{ marginTop: 8 }}>上传</div>
    </div>
  );
  const submit = () => {
    const _data = {
      txt3: value3,
      txt4: value4,
      txt5: value5,
      txt6: value6,
      uSchoolId: schoolId,
    };
    api.manageConcat({ ..._data }).then(res => {
      message.success('提交成功！');
    });
  };
  const inputChange3 = (e: any) => {
    setValue3(e.target.value);
  };
  const inputChange4 = (e: any) => {
    setValue4(e.target.value);
  };
  const inputChange5 = (e: any) => {
    setValue5(e.target.value);
  };
  const inputChange6 = (e: any) => {
    setValue6(e.target.value);
  };
  return (
    <CardCommon>
      <div className={styles.wrap}>
        <div className={styles.txt}>
          电话号码1：
          <Input
            className={styles.input}
            onChange={inputChange3}
            value={value3}
            type="number"
          />
        </div>
        <div className={styles.txt}>
          电话号码2：
          <Input
            className={styles.input}
            onChange={inputChange4}
            value={value4}
            type="number"
          />
        </div>
        <div className={styles.txt}>
          QQ1：
          <Input
            className={styles.input}
            onChange={inputChange5}
            value={value5}
            type="number"
          />
        </div>
        <div className={styles.txt}>
          QQ2：
          <Input
            className={styles.input}
            onChange={inputChange6}
            value={value6}
            type="number"
          />
        </div>

        <Button className={styles.submit} type="primary" onClick={submit}>
          提交
        </Button>
      </div>
    </CardCommon>
  );
};
